package interfaces.spawnMenu.costumize.items;

import org.fenggui.binding.render.ImageFont;
import org.fenggui.util.Color;

import fileHandling.language.Lang;
import interfaces.GUISource;
import interfaces.language.LanguageButton;
import interfaces.superWidgets.MoneyListener;

public class WeaponRestockButton extends LanguageButton implements MoneyListener {
	
	private int costs;
	private boolean full;
	
	public WeaponRestockButton(Lang text, int costs, ImageFont font) {
		super(text, font);
		this.costs = costs;
		
		full = true;
		
		changeLanguage();
	}
	
	@Override
	public void changeLanguage() {
		super.changeLanguage();
		setText(getText() + " (" + costs + ")");
	}
	
	@Override
	public void updateMoney(int newMoney) {
		if(newMoney >= costs || costs == 0) {
			GUISource.setTextColor(this, Color.WHITE);
			setEnabled(!full);
		} else {
			GUISource.setTextColor(this, Color.RED);
			setEnabled(false);
		}
	}
	
	public void setCosts(int costs) {
		this.costs = costs;
		changeLanguage();
	}
	
	public int getCosts() { return costs; }
	
	public void setFull(boolean full) {
		this.full = full;
		setEnabled(!full);
	}
}